#include <iostream>
#include <vector>
#include <tuple>
#include <array>
using namespace std;

int main()
{
    // 1.数组
    int arr[] = { 1, 2, 3 };
    auto [a, b, c] = arr;
    cout << a << " " << b << " " << c << endl;  //不占用内存

    // 2.元组
    std::tuple<int, std::string, double> t(1, "Hello", 2.0);
    auto [i, s, d] = t;
    cout << i << " " << s << " " << d << endl;  //占用内存

    // 3.结构体
    struct Point {
        int x, y;
    };
    Point p{ 1, 2 };
    auto [x, y] = p;                    //不占用内存
    cout << x << " " << y << endl;

    // 4.class
    class MyClass {
    public:
        int a, b;
    };
    MyClass obj{ 1, 2 };
    auto [m, n] = obj;                  //不占用内存
    cout << m << " " << n << endl;

    // 一对
    std::pair<int, std::string> p2(1, "Hello");
    auto [e, f] = p2;                   //占用内存
    cout << e << " " << f << endl;

    // 数组-固定大小
    std::array<int, 3> arr_fix{ 1, 2, 3 };
    auto [h, i, j] = arr_fix;

    return 0;
}
/*
注意: gdb调试 auto[a,b,c] 没有显示， 即没有占用内存空间

 */